<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::post('test','TestController@test');

Route::group([ 'prefix' => 'qiniu' ], function(){
    // 获取上传文件的token
    Route::get('/', 'QiniuController@getUpToken');
    // 获取七牛文件的url
    Route::get('/url', 'QiniuController@getFileUrl');
});

Route::group(['prefix' => 'admin','namespace' => 'Admin\View'],function(){
	require_once('web/View/admin.php');
	require_once('web/View/commodity.php');
	require_once('web/View/commodityType.php');
	require_once('web/View/user.php');
	require_once('web/View/order.php');
	require_once('web/View/desktop.php');
});

Route::group(['prefix' => 'api/admin','namespace' => 'Admin'],function(){
	require_once('web/Api/admin.php');
	require_once('web/Api/commodity.php');
	require_once('web/Api/user.php');
	require_once('web/Api/role.php');
	require_once('web/Api/order.php');
	require_once('web/Api/desktop.php');
});



Route::group(['prefix' => 'api/customer','namespace' => 'Customer'],function(){

	Route::post('login','CustomerController@login');

	Route::post('get-code','CustomerController@getCode');

	Route::post('login-code','CustomerController@codeLogin');

	Route::post('get-forget-code','CustomerController@getForgetCode');

	Route::post('get-register-code','CustomerController@getRegisterCode');

	Route::post('forget-password','CustomerController@forgetPwd');

	Route::post('register','CustomerController@register');

	Route::group(['middleware' => 'auth'],function(){
		
		Route::post('update-password','CustomerController@updatePwd');

		Route::post('logout','CustomerController@logout');
	});
});

Route::group(['prefix' => 'api/info','middleware' => 'auth','namespace' => 'Customer'],function(){

	Route::get('get-info','CustomerInfoController@getInfo');

	Route::post('add-info','CustomerInfoController@createInfo');

	Route::post('update-info','CustomerInfoController@updateInfo');

});

Route::group(['prefix' => 'api/address','middleware' => 'auth','namespace' => 'Customer'],function(){

	Route::get('get-address','AddressController@getAddress');

	Route::post('add-address','AddressController@addAddress');

	Route::post('update-address','AddressController@updateAddress');

	Route::post('delete-address','AddressController@deleteAddress');
});

Route::group(['prefix' => 'api/recovery','middleware' => 'auth','namespace' => 'Customer'],function(){

	Route::post('add-recovery','RecoveryController@addRecovery');

	Route::get('get-recovery-status','RecoveryController@getRecoveryByStatus');

	Route::get('get-recovery','RecoveryController@getRecoveries');

	Route::post('update-recovery','RecoveryController@updateRecovery');

	Route::get('get-recovery-type','RecoveryController@getRecoveryTypes');
});

Route::group(['prefix' =>'api/collection','middleware' => 'auth','namespace' => 'Customer'],function(){

	Route::get('get-collection','CollectionController@getCollection');

	Route::post('add-collection','CollectionController@addCollection');

	Route::post('update-collection','CollectionController@updateCollection');
});

Route::group(['prefix' => 'api/order','middleware' => ['auth'],'namespace' => 'Customer'],function(){

	Route::get('get-orders','OrderController@getOrders');

	Route::get('get-order','OrderController@getOrder');

	Route::post('add-order','OrderController@addOrder');
});

Route::group(['prefix' => 'api/recyclingBag','middleware' => ['auth'],'namespace' => 'Customer'],function(){

	Route::post('add-recyclingbag','RecyclingBagController@addRecyclingBag');
});










